package com.gjy.leetcode;

/**
 * 2180. 统计各位数字之和为偶数的整数个数
 *
 * @author 宫静雨
 * @version 1.0
 * @since 2023-01-06 09:45:05
 */
public class A2180 {

    public int countEven(int num) {
        int res = 0;
        for (int i = 1; i <= num; i++) {
            int x = i, sum = 0;
            while (x != 0) {
                sum += (x % 10);
                x /= 10;
            }
            if (sum % 2 == 0) {
                res++;
            }
        }
        return res;
    }
}
